const {
    Random
} = require("mockjs")
const Mock = require("mockjs")
const Delicacy = require("../model/Delicacy")


//创建数据的函数
async function delicacyData(owenerId) {
    //酒店列表数据
    const {
        delicacyList
    } = Mock.mock({
        "delicacyList|20": [{
            'goodsId': '@id',
            'owenerId': owenerId,
            'city': '@county(true)' + " @cword(10)",
            'title|5-10': '@cword',
            'visitor|2-8': 0,
            'picUrl': Random.image("300x200", "#50B347", "#FFF", "@word(10)"),
            'offical|20-40': '@cword',
            'score|2-5': 0,
            'likeygoodNum|10-1000':0
        }]
    })
    const res = await Promise.all(
        delicacyList.map((item) => {
            // console.log(item);
            return Delicacy.create(item)
        })
    )
}


module.exports = delicacyData